/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package economicocontrol.dao.entity;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author iMac
 */
@Entity
@Table(name = "registro_economicos")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "RegistroEconomicos.findAll", query = "SELECT r FROM RegistroEconomicos r"),
    @NamedQuery(name = "RegistroEconomicos.findByIdEconomicos", query = "SELECT r FROM RegistroEconomicos r WHERE r.idEconomicos = :idEconomicos"),
    @NamedQuery(name = "RegistroEconomicos.findByNumeroeconomico", query = "SELECT r FROM RegistroEconomicos r WHERE r.numeroeconomico = :numeroeconomico")})
public class RegistroEconomicos implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "id_economicos")
    private Integer idEconomicos;
    @Column(name = "Numero_economico")
    private String numeroeconomico;
    @JoinColumn(name = "Registro_Personal_idRegistro_Personal", referencedColumnName = "idRegistro_Personal")
    @ManyToOne(optional = false)
    private RegistroPersonal registroPersonalidRegistroPersonal;
    @JoinColumn(name = "Status_Economico_Id_StatusEco", referencedColumnName = "Id_StatusEco")
    @ManyToOne(optional = false)
    private StatusEconomico statusEconomicoIdStatusEco;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "registroEconomicosideconomicos")
    private Collection<RegistroEntradaSalida> registroEntradaSalidaCollection;

    public RegistroEconomicos() {
    }

    public RegistroEconomicos(Integer idEconomicos) {
        this.idEconomicos = idEconomicos;
    }

    public Integer getIdEconomicos() {
        return idEconomicos;
    }

    public void setIdEconomicos(Integer idEconomicos) {
        this.idEconomicos = idEconomicos;
    }

    public String getNumeroeconomico() {
        return numeroeconomico;
    }

    public void setNumeroeconomico(String numeroeconomico) {
        this.numeroeconomico = numeroeconomico;
    }

    public RegistroPersonal getRegistroPersonalidRegistroPersonal() {
        return registroPersonalidRegistroPersonal;
    }

    public void setRegistroPersonalidRegistroPersonal(RegistroPersonal registroPersonalidRegistroPersonal) {
        this.registroPersonalidRegistroPersonal = registroPersonalidRegistroPersonal;
    }

    public StatusEconomico getStatusEconomicoIdStatusEco() {
        return statusEconomicoIdStatusEco;
    }

    public void setStatusEconomicoIdStatusEco(StatusEconomico statusEconomicoIdStatusEco) {
        this.statusEconomicoIdStatusEco = statusEconomicoIdStatusEco;
    }

    @XmlTransient
    public Collection<RegistroEntradaSalida> getRegistroEntradaSalidaCollection() {
        return registroEntradaSalidaCollection;
    }

    public void setRegistroEntradaSalidaCollection(Collection<RegistroEntradaSalida> registroEntradaSalidaCollection) {
        this.registroEntradaSalidaCollection = registroEntradaSalidaCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idEconomicos != null ? idEconomicos.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof RegistroEconomicos)) {
            return false;
        }
        RegistroEconomicos other = (RegistroEconomicos) object;
        if ((this.idEconomicos == null && other.idEconomicos != null) || (this.idEconomicos != null && !this.idEconomicos.equals(other.idEconomicos))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "economicocontrol.dao.entity.RegistroEconomicos[ idEconomicos=" + idEconomicos + " ]";
    }
    
}
